\section{Source/LinkedList.c}


\begin{footnotesize}\begin{alltt}
00001 \textcolor{preprocessor}{#include "LinkedList.h"}
00002 
00003 \textcolor{preprocessor}{#ifdef \_\_cplusplus}
00004 \textcolor{preprocessor}{}\textcolor{keyword}{extern} \textcolor{stringliteral}{"C"}
00005 \{
00006 \textcolor{preprocessor}{#endif}
00007 \textcolor{preprocessor}{}
00008 LL_Element *LL\_AppendElement(LL_Element *First, LL_Element *Second)
00009 \{
00010     First->Next = Second;
00011     Second->Next = (LL_Element *)NULL;
00012     \textcolor{keywordflow}{return} First;
00013 \}
00014 
00015 LL_Element *LL\_InsertElement(LL_Element *First, LL_Element *Second)
00016 \{
00017     LL_Element *TempPointer = First->Next;
00018     First->Next = Second;
00019     Second->Next = TempPointer;
00020     \textcolor{keywordflow}{return} First;   
00021 \}
00022 
00023 LL_Element *LL\_GetNthElementFrom(LL_Element *From, \textcolor{keywordtype}{int} N)
00024 \{
00025     \textcolor{keywordtype}{int} X;
00026     LL_Element *CurrentPointer = From;
00027     \textcolor{keywordflow}{for}(X = 0; X < N; ++X)
00028     \{
00029         CurrentPointer = CurrentPointer->Next;
00030         \textcolor{keywordflow}{if}(CurrentPointer == NULL)
00031             \textcolor{keywordflow}{return} NULL;
00032     \}
00033     \textcolor{keywordflow}{return} CurrentPointer;
00034 \}
00035 
00036 \textcolor{keywordtype}{int} LL\_GetSizeFrom(LL_Element *From)
00037 \{
00038     \textcolor{keywordtype}{int} Size = 0;
00039     LL_Element *Current = From;
00040     \textcolor{keywordflow}{while}(Current->Next != NULL)
00041     \{
00042         ++Size;
00043         Current = Current->Next;
00044     \}
00045     \textcolor{keywordflow}{return} Size + 1;
00046 \}
00047 
00048 LL_Element *LL\_RemoveElementsBetween(LL_Element *One, LL_Element *Two)
00049 \{
00050     One->Next = Two;
00051     \textcolor{keywordflow}{return} One;
00052 \}
00053 
00054 LL_Element *LL\_AppendList(LL_Element *ListOne, LL_Element *ListTwo)
00055 \{
00056     ListOne->Next = ListTwo;
00057     \textcolor{keywordflow}{return} ListOne;
00058 \}
00059 
00060 LL_Element *LL\_InsertListIntoList(LL_Element *At, LL_Element *List)
00061 \{
00062     LL_Element *TempPointer = At->Next, *ListTempPointer = List;
00063     \textcolor{comment}{/* Find the end of the list */}
00064     \textcolor{keywordflow}{while}(ListTempPointer->Next != NULL)
00065         ListTempPointer = ListTempPointer->Next;
00066     ListTempPointer->Next = TempPointer;
00067     At->Next = List;
00068     \textcolor{keywordflow}{return} At;
00069 \}
00070 \textcolor{preprocessor}{#ifdef \_\_cplusplus}
00071 \textcolor{preprocessor}{}\}
00072 \textcolor{preprocessor}{#endif}
\end{alltt}\end{footnotesize}
